#ifndef __GPIO_H__
#define __GPIO_H__

#include <stdint.h>

#define SYS_GPIO_DIR "/sys/class/gpio"
#define MAX_BUF_LEN		64

#define SUCCESS 0
#define FAILED  -1

typedef enum {
    DIRECTION_INPUT  = 0,
    DIRECTION_OUTPUT = 1
}PIN_DIRECTION;

typedef enum {
    VALUE_LOW  = 0,
    VALUE_HIGH = 1
}PIN_VALUE;

typedef enum {
    IT_NONE = 0,
    IT_RISING = 1,
    IT_FALLING = 2,
    IT_RISING_FALLING = 3
}PIN_IT_EDGE;


int gpio_export(unsigned char gpio_pin_number);
int gpio_unexport(unsigned char gpio_pin_number);
int gpio_set_direction(unsigned char gpio_pin_number, PIN_DIRECTION pin_direction);
int gpio_set_it_edge(unsigned char gpio_pin_number, PIN_IT_EDGE pin_edge);
int gpio_set_value(unsigned char gpio_pin_number, PIN_VALUE pin_value);
int gpio_get_value(unsigned char gpio_pin_number, uint32_t  *pin_value);

#endif